package org.flash.text{
    import flash.text.*;

	/**
	 * 继承文本
	 * 创建默认的文本格式
	 * @author Administrator
	 * 
	 */	
    public class TextFieldFormat extends TextField {
        private var _textFormat:TextFormat;

        public function TextFieldFormat(size:int = 12, color:uint = 0, font:Font = null, bold:Boolean = false, 
										letterSpacing:Number = 0, leading:Number = 0, align:String = "left") {
            this._textFormat = new TextFormat();
            this._textFormat.size = size;
			this._textFormat.color = color;
            this._textFormat.bold = bold;
            this._textFormat.align = align;
            this._textFormat.letterSpacing = letterSpacing;
            this._textFormat.leading = leading;
            this.autoSize = align;
			
			/**嵌入字体类型*/
            if (font != null){
                this.embedFonts = true;
                this.antiAliasType = AntiAliasType.ADVANCED;
                _textFormat.font = font.fontName;
            }
        }
		
        override public function set text(str:String) : void {
            super.text = str;
            this.setTextFormat(_textFormat);
        }
        override public function appendText(str:String) : void {
            super.appendText(str);
			this.setTextFormat(_textFormat);
        }
    }
}
